package com.wego.controller;

import com.wego.common.bean.PageBean;
import com.wego.entity.domain.Goods;
import com.wego.entity.query.GoodsQuery;
import com.wego.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

/**
 * @className: UserIndexController
 * @description: TODO 类描述
 * @author: Li Chuanwei
 * @date: 2023/07/16 17:42
 * @Company: Copyright [日期] by [作者或个人]
 **/

@Controller
public class UserIndexController {

    @Autowired
    GoodsService goodsService;

    @GetMapping("/userIndex")
    public String goToHome(Model model) {
        GoodsQuery goodsQuery = new GoodsQuery();
        goodsQuery.setPageSize(24);
        PageBean<Goods> pageBean = goodsService.selectPage(goodsQuery);
        List<Goods> goodsList = pageBean.getResult();
        model.addAttribute("goodsList",goodsList);
        return "user/index";
    }
}
